<?php
/**
* @desc  Handles  all redquests and decided on action based on request
* 
* 
*/
session_start();
	$_REQUEST['Page'] = (isset($_REQUEST['Page']) && strlen($_REQUEST['Page']) > 0) ? $_REQUEST['Page'] : "Login";
	$PAGE=file_exists("templates/Pages/".$_REQUEST['Page'].".tpl")? $_REQUEST['Page'] : "Login" ;

	$_REQUEST['Action'] = (isset($_REQUEST['Action']) && strlen($_REQUEST['Action']) > 0) ? $_REQUEST['Action'] : "Login";
	$ACTION=$_REQUEST['Action'];
/** 
* @desc Loads globaly needing  objects/varibles
* @items Functions,Logger,ErrorLogger,Smarty,Global Smarty Assignments , Config,Class Loading, and more
*/
	require_once("code/global.init.php");


/** Fetch Header and Footer  - You dont want to do this to early so all varibles are defined **/
	$tSmartyAssigments = array (
			"THEHEAD"			=>	$smarty->fetch("templates/Pages/Header.tpl"),
			"PAGE"				=> $_REQUEST['Page'],
			"THEFOOT"			=>	$smarty->fetch("templates/Pages/Footer.tpl"),
			
			);
	$objMyAPP->objSmarty->AssignByArray($tSmartyAssigments);


/** Output Page **/

	$content = $objMyAPP->objSmarty->fetch("templates/Pages/". $PAGE . ".tpl");
	echo $content;

	exit;


?>
